package cn.xsw.entity.query;

import cn.hutool.core.util.StrUtil;
import cn.xsw.entity.Business;
import cn.xsw.utils.BaseQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;

@Data
public class BusinessQuery extends BaseQuery<Business> {
    @ApiModelProperty(value = "名称")
    private String title;

    @ApiModelProperty(value = "分类",example = "0")
    private Integer cid;
    public BusinessQuery(){
        this.cid = 0;
    }

    // 条件
    public QueryWrapper wrapper() {
        QueryWrapper<Business> wrapper = new QueryWrapper<>();
        if (!StrUtil.isEmpty(title)) wrapper.like("title",this.title);
        if (cid!=0) wrapper.eq("cid", this.cid);
        return wrapper;
    }
}
